<template>
  <div>
    <a-card>
      <a-row :gutter="24">
        <a-col :span="24">
          <a-tabs>
            <a-tab-pane key="1" tab="进货">
              <a-col :span="24">
                <Purchase />
              </a-col>
            </a-tab-pane>
            <a-tab-pane key="2" tab="退货">
              <a-col :span="24">
                <Refund />
              </a-col>
            </a-tab-pane>
          </a-tabs>
        </a-col>
      </a-row>
    </a-card>

    <a-card class="mt-2">
      <div>
        <p class="text-lg font-bold">查询</p>
        <vxe-grid ref="xGrid" v-bind="gridOptions" v-on="gridEvent">
          <template #order_type="{ row }">
            {{ row.order_type == 1 ? "进货" : "退货" }}
          </template>
          <template #action="{ row }">
            <vxe-button
              status="primary"
              content="详情"
              @click="detail(row)"
            ></vxe-button>
          </template>
        </vxe-grid>
      </div>
    </a-card>
  </div>
</template>

<script setup lang="ts">
import Purchase from "./components/purchase/purchase.vue";
import Refund from "./components/purchase/refund.vue";
import useRuleStore from "@/store/modules/rule";
import { message } from "ant-design-vue";
import { VXETable } from "vxe-table";
const { gridOptions } = usePurchaseOrder();
const xGrid = ref();
const toolbarRef = ref();
const router = useRouter();
const gridEvent: VxeGridListeners<RowVO> = {
  proxyQuery() {
    console.log("数据代理查询事件");
    const grid = xGrid.value;
  },
  proxyDelete() {
    console.log("数据代理删除事件");
  },
  proxySave() {
    console.log("数据代理保存事件");
  },
};

const detail = (row) => {
  router.push(`/inventory/product/${row.id}/receiptitem`);
};
</script>

<style></style>
